package cglib;

import org.springframework.cglib.proxy.MethodInterceptor;
import org.springframework.cglib.proxy.MethodProxy;
import java.lang.reflect.Method;

public class CglibProxy implements MethodInterceptor {


    @Override
    public Object intercept(Object o, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
        String name = method.getName();
        System.out.println("执行之前"+name);
        Object obj = methodProxy.invokeSuper(o,args);
        System.out.println("执行之后"+name);
        return obj;
    }
}
